package us.mooresr.geartrack.server.handler;

import us.mooresr.geartrack.server.DAO;
import us.mooresr.geartrack.shared.action.DeleteItemTypeAction;
import us.mooresr.geartrack.shared.action.DeleteItemTypeResult;

import com.gwtplatform.dispatch.server.ExecutionContext;
import com.gwtplatform.dispatch.server.actionhandler.ActionHandler;
import com.gwtplatform.dispatch.shared.ActionException;

public class DeleteItemTypeActionHandler implements ActionHandler<DeleteItemTypeAction, DeleteItemTypeResult>{

	@Override
	public DeleteItemTypeResult execute(DeleteItemTypeAction action,
			ExecutionContext arg1) throws ActionException {
		DAO dao = new DAO();
		
		dao.ofy().delete(action.getItemTypeIn());
		
		return new DeleteItemTypeResult(action.getItemTypeIn());
	}

	@Override
	public Class<DeleteItemTypeAction> getActionType() {
		return DeleteItemTypeAction.class;
	}

	@Override
	public void undo(DeleteItemTypeAction arg0, DeleteItemTypeResult arg1,
			ExecutionContext arg2) throws ActionException {
		// TODO Auto-generated method stub
		
	}

}
